//
//  UICustomPickerView.h
//  nonghubao
//
//  Created by Fenrir on 13-6-23.
//  Copyright (c) 2013年 Chongqing Nonghubao Co., Ltd. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "HZAreaPickerView.h"

typedef enum
{
    UICustomPickerViewNormalType=0,
    UICustomPickerViewDateType,
    UICustomPickerViewAreaType
    
}UICustomPickerViewType;

@protocol UICustomPickerViewDelegate;
@protocol UICustomPickerViewDataSource;

@interface UICustomPickerView : UIView<UIPickerViewDelegate, UIPickerViewDataSource, HZAreaPickerDelegate>
{
    UICustomPickerViewType _type;
    
    NSString *_areaString;
}

//普通pickerView
@property (nonatomic, strong, readonly) UIPickerView *normalPickerView;
@property (nonatomic, readonly) NSInteger selectedRow;
@property (nonatomic, readonly) NSInteger selectedComponent;

//地址选择PickerView
@property (strong, nonatomic, readonly) HZAreaPickerView *areaPickerView;
@property (nonatomic) HZAreaPickerStyle hzAreaPickerStyle;
@property (nonatomic) HZAreaPickerInitOption areaPickerOption;
@property (strong, nonatomic) NSString *location;

//日期选择PickerView
@property (nonatomic, strong, readonly) UIDatePicker *datePickerView;
@property (strong, nonatomic) NSDate *currentDate;

@property (nonatomic, strong) UIToolbar *toolBar;
@property (nonatomic, weak) id<UICustomPickerViewDataSource> dataSource;
@property (nonatomic, weak) id<UICustomPickerViewDelegate> delegate;

- (void)pickerShow:(UICustomPickerViewType)type;
- (void)pickerHide;

- (void)selectRow:(NSInteger)row inComponent:(NSInteger)component animated:(BOOL)animated;

@end


@protocol UICustomPickerViewDelegate <NSObject>

@optional
- (NSString *)customPickerView:(UICustomPickerView *)customPickerView titleForRow:(NSInteger)row
                  forComponent:(NSInteger)component;
- (void)customPickerView:(UICustomPickerView *)customPickerView didSelectRow:(NSInteger)row
             inComponent:(NSInteger)component;

- (void)customPickerView:(UICustomPickerView *)customPickerView areaStringReceived:(NSString *)area;

- (void)customPickerViewDateChanged:(NSString *)date;

- (void)customPickerViewDidDismiss:(UICustomPickerView *)customPickerView;
@end

@protocol UICustomPickerViewDataSource <NSObject>
@optional
- (NSInteger)numberOfComponentsInUICustomPickerView:(UICustomPickerView *)customPickerView;
- (NSInteger)customPickerView:(UICustomPickerView *)customPickerView
      numberOfRowsInComponent:(NSInteger)component;

@end